Socket
Socket
Sign inDemoInstall

columnify

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

columnify

Render data in text columns. Supports in-column text-wrap.


Version published
Weekly downloads
3.3M
decreased by-2.35%
Maintainers
1
Weekly downloads
 
Created

What is columnify?

The columnify npm package is a utility that allows for formatting console output into a columnar data format. It is particularly useful for creating readable tables out of JSON data or arrays of objects. With columnify, you can easily align text in columns, customize column widths, and manage how text wraps within columns.

What are columnify's main functionalities?

Basic Column Formatting

This feature allows for the simple transformation of an array of objects into a neatly formatted table. Each object property becomes a column.

const columnify = require('columnify')
const data = [{ name: 'John', age: 22 }, { name: 'Jane', age: 33 }]
console.log(columnify(data))

Custom Column Widths

This feature enables the customization of column widths, allowing for a uniform appearance or to accommodate longer text without breaking the layout.

const columnify = require('columnify')
const data = [{ name: 'John', age: 22 }, { name: 'Jane', age: 33 }]
console.log(columnify(data, { minWidth: 20 }))

Column Alignment

This feature allows for the alignment of text within columns. In this example, the 'age' column is right-aligned, enhancing the readability of numerical data.

const columnify = require('columnify')
const data = [{ name: 'John', age: 22, location: 'New York' }, { name: 'Jane', age: 33, location: 'California' }]
console.log(columnify(data, { config: { age: { align: 'right' } } }))

Other packages similar to columnify

Keywords

FAQs

Package last updated on 03 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc